/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ordering.pojo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author sulan
 */
@Entity
@Table(name = "t_menu")
@NamedQueries({@NamedQuery(name = "TMenu.findAll", query = "SELECT t FROM TMenu t"), @NamedQuery(name = "TMenu.findByMenuId", query = "SELECT t FROM TMenu t WHERE t.menuId = :menuId"), @NamedQuery(name = "TMenu.findByFoodName", query = "SELECT t FROM TMenu t WHERE t.foodName = :foodName"), @NamedQuery(name = "TMenu.findByPrice", query = "SELECT t FROM TMenu t WHERE t.price = :price"), @NamedQuery(name = "TMenu.findByPhotoName", query = "SELECT t FROM TMenu t WHERE t.photoName = :photoName")})
public class TMenu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "menu_id")
    private Long menuId;
    @Column(name = "food_name")
    private String foodName;
    @Column(name = "price")
    private Float price;
    @Lob
    @Column(name = "description")
    private String description;
    @Lob
    @Basic(fetch=FetchType.LAZY)
    @Column(name = "photo")
    private byte[] photo;
    @Column(name = "photo_name")
    private String photoName;
    @JoinColumn(name = "food_type_oid", referencedColumnName = "food_type_oid")
    @ManyToOne(fetch = FetchType.EAGER)
    private TFoodType foodTypeOid;

    public TMenu() {
    }

    public TMenu(Long menuId) {
        this.menuId = menuId;
    }

    public Long getMenuId() {
        return menuId;
    }

    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    public String getFoodName() {
        return foodName;
    }

    public void setFoodName(String foodName) {
        this.foodName = foodName;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public byte[] getPhoto() {
        return photo;
    }

    public void setPhoto(byte[] photo) {
        this.photo = photo;
    }

    public String getPhotoName() {
        return photoName;
    }

    public void setPhotoName(String photoName) {
        this.photoName = photoName;
    }

    public TFoodType getFoodTypeOid() {
        return foodTypeOid;
    }

    public void setFoodTypeOid(TFoodType foodTypeOid) {
        this.foodTypeOid = foodTypeOid;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (menuId != null ? menuId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TMenu)) {
            return false;
        }
        TMenu other = (TMenu) object;
        if ((this.menuId == null && other.menuId != null) || (this.menuId != null && !this.menuId.equals(other.menuId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return foodName;
    }

}
